package com.gitee.liang521.generate.api.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.gitee.liang521.generate.api.pojo.dao.TableDao;
import com.gitee.liang521.generate.api.pojo.entity.TableEntity;
import com.gitee.liang521.generate.api.pojo.maps.TableMaps;
import com.gitee.liang521.generate.api.pojo.vo.generate.ListResVo;
import com.gitee.liang521.generate.api.service.TableService;
import org.springframework.lang.NonNull;

import javax.annotation.Resource;
import java.util.Collections;
import java.util.List;

/**
 * @author liang zai
 * @date 2021/9/16 15:09
 * @description
 */
public class TableServiceImpl extends ServiceImpl<TableDao, TableEntity> implements TableService {

    @Resource
    private TableMaps tableMaps;

    @Override
    @NonNull
    public List<ListResVo> listQuery() {
        List<TableEntity> list = this.baseMapper.listQuery();
        return list == null ? Collections.emptyList() : tableMaps.poToVo(list);
    }

    @Override
    public TableEntity getByName(String k) {
        return this.baseMapper.getByName(k);
    }
}
